package com.example.demo.mapper;
import com.example.demo.domain.KgFile;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 知识图谱后端接口 Mapper
 * 用于关联数据库与后端
 * @author wzh
 * @date 2025.4.16
 */

@Mapper
public interface KgFileMapper {
    @Insert("insert into knowledge_file_resource(name, description, path, connect_id, type, url) values(#{name}, #{description}, #{path}, #{connect_id}, #{type}, #{url})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void add(KgFile kgFile);

    @Select("select id, name, description, path, connect_id from knowledge_file_resource where connect_id = #{id}")
    List<KgFile> getById(Integer id);

    @Delete("delete from knowledge_file_resource where id = #{id}")
    void deleteById(Integer id);
}
